console.log("hello");
const num = 3;
console.log(num);

function fn(name: string, aaa?: number): string;
function fn(age: number, aaa?: string): number;
function fn(arg1: string | number, aaa?: number | string) {
    return arg1;
}

const isFunction = (data: unknown): data is Function => {
    return true;
}
const a = "asdf";
if (isFunction(a)) {
    a()
}
const fn2 = (a: "asdf" | 123): never | number => {
    switch (a) {
        case "asdf":
            return 123
        case 123:
            return 123

        default:
            return a;
    }
}
const asd = fn2(123)

const arr1 = [1, 2] as const;
// arr1[0] = 100  报错

const fnReadonly = (arr: readonly number[]) => {
    // arr[0] = "asdf" 报错  readonly只读不可修改
    return arr;
}
const aaa = [123]
fnReadonly(aaa)
fnReadonly(arr1)

const fnExtends = <T>(arg: T extends number? T: never) => {
    if(typeof arg === "number") {
        return arg;
    }
    return arg;
}



export default num;
